<?php 
$url = $this->baseUrl();
$storage = new Zend_Auth_Storage_Session();
$data = $storage->read();
?>

<div class="front-bg">
	<img class="front-image" src="<?php echo $this->dirImg;?>/bg-land.jpg">
</div>

<div class="page-canvas" style="width: 100%;margin:0px;">

	<div style="width: 700px; margin: auto;">
		
		<div class="content-main">

            <div class="content-header">

                <div class="header-inner">

                    <h3 style="font-size: 12px;">
                    	<?php if ($this->follower == ""):?>
                         Chúc mừng bạn đăng ký thành công, bạn hãy cập nhật avatar và thông tin cá nhân:
                         <?php else :?>
                         Bạn hãy kết nối với những channels và bạn bè mà bạn thích
                         <?php endif;?>
                    </h3>

                </div>

            </div>

            <div class="js-tweet-preview-container"></div>
            
            <?php if ($this->follower == ""):?>

            <div class="welcome-faux-tweet-stream js-welcome-faux-tweet-stream">



                <div class="unfocusable-stream-item stream-item js-intro-tweet">

                    <div class="tweet js-unclickable-tweet unclickable-tweet" style="opacity: 1;">

							<div class="avatar" style="width: 100px; height: 100px; top: 12px;">
							
								<p>
								<a href="#">
								
								<?php if($data->avatar != ""):?>
								
									<img id="avatar" alt="noavatar" style="width: 100px; height: 100px;" src="<?php echo $url;?>/upload/<?php echo $data->avatar;?>">
									
								<?php else :?>
									<img id="avatar" alt="noavatar" style="width: 100px; height: 100px;" src="http://0.gravatar.com/avatar/98d7a2361501957b551a32fceca493a5?s=56&d=mm&r=G">
								<?php endif;?>
								</a>
								</p>
								<form enctype="multipart/form-data" name="uploadavatar" id="uploadavatar" method="POST" action="<?php echo $url;?>/registration/auth/uploadavatar/">		
													
									<label id="camera" style="margin-left: -10px; margin-top: -10px;" class="ipt-form-upload-label" data-title="Insert Media" data-delay="{ show: 500, hide: 100 }" data-placement="bottom" >

					                   <span>Upload Avatar</span>
					
					                   <span><input type="file" id="myfile_avatar" name="myfile" /></span>
					
					                   <div class="clearfix"></div>
					                   
					              </label>
					               	
								</form>
							</div>
							<form method="post" name="form_info">
								<div class="blank-info">									
									<p class="innerWrap info">
										<span class="icon-lock"></span>									
										</span>
										<input name="txt_company" type="text" class="inputtext-blank textInput DOMControl_placeholder"  placeholder="Bạn làm việc ở đâu?" onblur="updateProfile('txt_company','txt_school','txt_home');"  value="">
									</p>									
									<p class="innerWrap info">
										<span class="icon-folder-close"></span>									
										<input name="txt_school" type="text" id="txt_school" class="inputtext-blank textInput DOMControl_placeholder"  placeholder="Bạn học trường nào?" onblur="updateProfile('txt_company','txt_school','txt_home');" value="">
									</p>									
									<p class="innerWrap info">
										<span class="icon-home"></span>									
										<input name="txt_home" type="text" id="txt_home" class="inputtext-blank textInput DOMControl_placeholder"  placeholder="Bạn lớn lên ở đâu?" onblur="updateProfile('txt_company','txt_school','txt_home');"  value="">
									</p>									
									<p class="innerWrap info">
										<span class="icon-heart"></span>									
										<input name="txt_heart" type="text" id="txt_home" class="inputtext-blank textInput DOMControl_placeholder"  placeholder="Sở thích của bạn là gì?"  value="">
									</p>									
								</div>
							</form>
						</div>

                    </div>

                </div>
                
                <?php else:?>
                
                <div class="welcome-faux-tweet-stream js-welcome-faux-tweet-stream">

                <div class="unfocusable-stream-item stream-item js-intro-tweet">

                    <div class="tweet js-unclickable-tweet unclickable-tweet" style="opacity: 1;height: auto;">

                    	<div  class="unfocusable-stream-item stream-item" style="border: 0;">
                    	
                    		<!-- 
                    	    <p>
                    	    	Để có được những channels, bạn bè phù hợp với sở thích của bạn. Bạn hãy điền sở thích của bạn và chúng tôi sẽ tìm cho bạn channels và bạn bè mà bạn thích.
                    	    </p>
                    	    <p class="innerWrap info">
								<span class="icon-heart"></span>									
								<input name="txt_heart" type="text" id="txt_heart" class="inputtext-blank textInput DOMControl_placeholder"  placeholder="Sở thích của bạn là gì?"  value="" onkeypress="onLoadChannelFriend('txt_heart');">
							</p>             		
							 !-->
							 
							<div id="datachanel"> 
								<h5 style="color: #db5c56;">Channels mà bạn có thể thích:</h5>
								<iframe width="100%" height="200" style="border: 0;" src="<?php echo $url;?>/chanel/list/"></iframe>
								
                    		</div>
                    		
                    		<div class="tweet" style="border: 0; height: auto; clear: left; height: 5px;padding:0; min-height: auto;"></div>
                    		
                    		
							
                    		<div id="datafriend">
                    		
                    			<h5 style="color: #db5c56;">Những người bạn có cùng sở thích với bạn:</h5>
                    		
                    			<iframe width="100%" height="200" style="border: 0;" src="<?php echo $url;?>/registration/list/"></iframe>	
                    		
                    		
                    		</div>
                    		<div class="tweet" style="border: 0; height: auto; clear: left; height: 10px; min-height: auto;"></div>
                    		
                    	
                    	</div>
							
					</div>

                    </div>

                </div>
            
            
            	<?php endif;?>
                

            </div>
            

			<div class="clear"></div>            

            <div class="component js-stream-end" style="">
                <div class="stream-end">
                    <div class="stream-end-inner">

                    <div style="text-align: center;">
                    
                    	<?php if ($this->follower == ""):?>                        	                
                       		<a href="/registration/?follower=true" style="margin: 2px;">Bỏ qua</a>
                       		<a href="javascript:void(0);" class="btn btn-info" onclick="document.forms['form_info'].submit();">Tiếp tục</a>
                       	<?php else:?>
                       		<a href="/" style="margin: 2px;">Hoàn thành</a>
                       	<?php endif;?>
                       
                    </div>

                    </div>
                </div>
            </div>

        </div>
		
	</div>

</div>

<script type="text/javascript">

$(document).ready(function(){

	var options = {
            //target:        '#tutor',   // target element(s) to be updated with server response
            beforeSubmit:  showRequest,  // pre-submit callback
            success:       showResponse  // post-submit callback
           
        };

	$('#myfile_avatar').change(function() {		
	    
		$('#uploadavatar').submit();			    
	    
	});

	// bind form using 'ajaxForm'
	 // bind to the form's submit event 
    $('#uploadavatar').submit(function() { 
        // inside event callbacks 'this' is the DOM element so we first 
        // wrap it in a jQuery object and then invoke ajaxSubmit 
        $(this).ajaxSubmit(options); 
 
        // !!! Important !!! 
        // always return false to prevent standard browser submit and page navigation 
        return false; 
    }); 

    
        // pre-submit callback
        function showRequest(formData, jqForm, options) {
        
            var queryString = $.param(formData);

        
            //alert('About to submit: \n\n' + queryString);

        
            return true;
        }

        // post-submit callback
        function showResponse(responseText, statusText, xhr, $form)  {
        	
            $("#avatar").attr("src","<?php echo $url;?>/upload/"+responseText);
                               
        }

	
});

</script>

